Visual Basic Reference

DatabaseName Property

See Also    Example    Applies To

Returns or sets the name and location of the source of data for a Data control.

Syntax

object**.DatabaseName** [ **=**pathname ]

The DatabaseName property syntax has these parts:

Part Description
object An object expression that evaluates to an object in the Applies To list.
pathname A string expression that indicates the location of the database file(s) or the Data Source name for ODBC data sources.

Remarks

If your network system supports it, the pathname argument can be a fully qualified network path name such as \\Myserver\Myshare\Database.mdb.

The database type is indicated by the file or directory that pathname points to, as follows:

pathname Points To... Database Type
.mdb file Microsoft Access database
Directory containing .dbf file(s) dBASE database
Directory containing .xls file Microsoft Excel database
Directory containing .dbf files(s) FoxPro database
Directory containing .wk1, .wk3, .wk4, or .wks file(s) Lotus Database
Directory containing .pdx file(s) Paradox database
Directory containing text format database files Text format database

For ODBC databases, such as SQL Server and Oracle, this property can be left blank if the control's Connect property identifies a data source name (DSN) that identifies an ODBC data source entry in the registry.

If you change the DatabaseName property after the control's Database object is open, you must use the Refresh method to open the new database.

Note   For better performance when accessing external databases, it's recommended that you attach external database tables to a Microsoft Jet engine database (.mdb) and use the name of the Jet .mdb database in the DatabaseName property.

Data Type

String